home *** CD-ROM | disk | FTP | other *** search
- Path: news-m01.ny.us.ibm.net!usenet
- From: bbogard@ibm.net
- Newsgroups: comp.lang.c++,comp.lang.fortran
- Subject: Re: Calling C++ from FORTRAN on VMS
- Date: 21 Feb 1996 20:52:24 GMT
- Message-ID: <4gg0m8$401m@news-s01.ny.us.ibm.net>
- References: <31239D17.3159@stsci.edu>
- Reply-To: bbogard@ibm.net
- NNTP-Posting-Host: slip37-223-98.ibm.net
- X-Newsreader: IBM NewsReader/2 v1.2.5
-
- In <31239D17.3159@stsci.edu>, Scott Stallcup <stallcup@stsci.edu> writes:
- >I need to call a C++ routine from a FORTRAN routine on both
- >VAX/VMS and AXP/VMS platforms.
- >
- >The C++ documentation fails to mention mixed langage programs
- >(other than calling C from C++)...
- >
- >Given the following example code, what compiler/linker options
- >will resolve the c++ reference ?
- >
- >---------------------------------------------------------------
- > program tfor
- >c
- > call tcxx ()
- >c
- > end
- >---------------------------------------------------------------
- >
- >#include <stdio.h>
- >
- >void tcxx (void)
- > {
- > printf ("Hello World\n");
- > }
- >
- >---------------------------------------------------------------
- >$ fortran tfor
- >$ cxx tcxx
- >$ link tfor,tcxx
- >%LINK-W-NUDFSYMS, 1 undefined symbol:
- >%LINK-I-UDFSYM, TCXX
- >%LINK-W-USEUNDEF, undefined symbol TCXX referenced
- > in psect $LINK$ offset %X00000020
- > in module TFOR
- >$
- >
- >---------------------------------------------------------------
- >
- >Thanks,
- >
- >--------------------------------------
- >Scott Stallcup (stallcup@stsci.edu)
- >Space Telescope Science Institute
-
- I would think that the best way to attach the two source code systems, would be to
- make a C interface that allows Fortan and C++ to talk. This would mean that the app
- may not be able to be multi threaded, but I don't think that matters much. All you need
- is the public symbol name, like _strcat, and a fortran linker that can like with public
- symbols generated from a c program.
-
- I would not suggest that you try attaching Fortan and C++ directly. Because of the '
- function tables of each object during runtime,
-
- Anyway, why not just port the fortran program to C or C++, unless of course you need
- imaginary number support. Then you''l have to find an imaginary number class library.
-
- Hope this helps.
-